package com.eptok.gw.szcups.pojo;

import org.dom4j.Document;
import org.dom4j.Element;

import ys8583.parse.IOMessage;


public class CtCardRepayment extends XmlMessage{
	private String creditAccount;		//信用卡卡号
	private String amount;				//金额(分)
	private PosData posData;
	///////////////////////////////////////////
	private CupsResult cupsResult;
	
	
	public String getCreditAccount() {
		return creditAccount;
	}
	public void setCreditAccount(String creditAccount) {
		this.creditAccount = creditAccount;
	}
	public String getAmount() {
		return amount;
	}
	public void setAmount(String amount) {
		this.amount = amount;
	}
	
	
	public String getRspSerialNumber() {
		return rspSerialNumber;
	}
	public void setRspSerialNumber(String rspSerialNumber) {
		this.rspSerialNumber = rspSerialNumber;
	}
	public CupsResult getCupsResult() {
		return cupsResult;
	}
	public void setCupsResult(CupsResult cupsResult) {
		this.cupsResult = cupsResult;
	}
	public PosData getPosData() {
		return posData;
	}
	public void setPosData(PosData posData) {
		this.posData = posData;
	}
	@Override
	protected void decodeBody(Document document) throws Exception {
		reqSerialNumber = ((Element) document.selectObject("/szcups/body/ReqSerialNumber")).getTextTrim();
		amount = (((Element) document.selectObject("/szcups/body/PayAmount")).getTextTrim());
		creditAccount = (((Element) document.selectObject("/szcups/body/CreditAccount")).getTextTrim());
		posData = decodePosData(document);
		
	}
	@Override
	protected String encodeBody(IOMessage iomessage) throws Exception {
		StringBuffer sb = new StringBuffer();
		sb.append("<body>");
		sb.append("<ReqSerialNumber>").append(reqSerialNumber).append("</ReqSerialNumber>");
		sb.append("<CreditAccount>").append(creditAccount).append("</CreditAccount>");
		sb.append("<PayAmount>").append(amount).append("</PayAmount>");
		sb.append("<RspSerialNumber>").append(rspSerialNumber).append("</RspSerialNumber>");
		sb.append(encodeCupsResult(iomessage));
		sb.append("</body>");
		return sb.toString();
	}
	
}
